﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using HomeFramework.Client.Forms;
using HomeFramework.Client.Utilities;

namespace HomeFramework.Client
{
    static class Program
    {
        private static Form mainForm = null;
        private static NotifyIcon buggyIcon = null;
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            HFUtils.SetupFirstStart();

            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            mainForm = new TrayForm();
            buggyIcon = mainForm.Controls.OfType<NotifyIcon>().FirstOrDefault();
            Application.Run(mainForm);
        }

      

        static void Application_ApplicationExit(object sender, EventArgs e)
        {
            if (buggyIcon != null) buggyIcon.Visible = false;
        }
    }
}
